/**
 * 
 */
package pt.mleiria.sAction.web.assets;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import pt.mleiria.sAction.bo.combos.LoadCombosBO;
import pt.mleiria.sAction.bo.mainPage.MainPageCommand;

/**
 * @author Manuel
 *
 */
public class AssetsMainViewController extends SimpleFormController{
	private LoadCombosBO loadCombosBO;
	

	/**
	 * @return the loadCombosBO
	 */
	public LoadCombosBO getLoadCombosBO() {
		return loadCombosBO;
	}

	/**
	 * @param loadCombosBO the loadCombosBO to set
	 */
	public void setLoadCombosBO(LoadCombosBO loadCombosBO) {
		this.loadCombosBO = loadCombosBO;
	}

	/* (non-Javadoc)
	 * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException)
	 */
	@Override
	protected ModelAndView onSubmit(HttpServletRequest request,
			HttpServletResponse response, Object command, BindException errors)
			throws Exception {
		// TODO Auto-generated method stub
		return super.onSubmit(request, response, command, errors);
	}

	/* (non-Javadoc)
	 * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest)
	 */
	@Override
	protected Object formBackingObject(HttpServletRequest request)
			throws Exception {
		MainPageCommand mainPageCommand = new MainPageCommand();
		mainPageCommand.setMarkets(loadCombosBO.loadMarkets());
		mainPageCommand.setTypes(loadCombosBO.loadTypes());

		return super.formBackingObject(request);
	}
	
	

}
